package com.java.tutorials.spring.aop;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * Created by xuzhike on 2016/1/30.
 */
public class CustomizableTraceInterceptor extends SpringAOPTester {
    public static Logger logger = LogManager.getLogger(CustomizableTraceInterceptor.class);
    @Override
    public void test() {
        MtBean1 testBean = (MtBean1) ctx
                .getBean("afterBean1");
        logger.debug("-------------------------log4j2");
        testBean.showValues();
    }
}

class MtBean1 {
    private String firstName;

    public String getFirstName() {
        return this.firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public void showValues() {
        CustomizableTraceInterceptor.logger.debug("name = "+this.firstName);
        System.out.println("First name: " + this.firstName);
    }
}
